<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /* 
        {} 表示一个对象
        对象由键值对（key-value-pair）构成，键又可以称为属性(attribute)
        */

    // 使用对象描述一下班长，属性包括：
    // 姓名、年龄、是否高富帅、思想空荡荡、老婆无可奉告、女朋友党哥年龄18；
      var banzhang = {
        name: "杰哥",
        age: 18,
        richTallHandsome: true,
        thinking: null,
        wife: undefined,
        girlfriend: {
          name: "党哥",
          age: 18,
        },
      };

      console.log("banzhang=", banzhang);

      // 看下班长的类型、班长女朋友的类型；
      console.log("typeof banzhang=", typeof banzhang);
      console.log("typeof(banzhang.girlfriend)=", typeof banzhang.girlfriend);

      // 访问一下班长的各种属性（点操作符）；
      console.log(banzhang.name);
      console.log(banzhang.age);
      console.log(banzhang.richTallHandsome);
      console.log(banzhang.thinking);
      console.log(banzhang.wife);

      // 访问一下班长的各种属性（中括号操作符）；
      console.log(banzhang["name"]);
      console.log(banzhang["age"]);
      console.log(banzhang["richTallHandsome"]);
      console.log(banzhang["thinking"]);
      console.log(banzhang["wife"]);
    </script>
  </body>
</html>
